var designWidth = 750;
var rate = 1;
var onClickStr = 'touchmove' in window ? 'tap' : 'click';
(function (doc, win) {
    var isPC = function() {
        //平台、设备和操作系统
        var system ={
            win : false,
            mac : false,
            xll : false
        };
        //检测平台
        var p = navigator.platform;
        system.win = p.indexOf("Win") == 0;
        system.mac = p.indexOf("Mac") == 0;
        system.x11 = (p == "X11") || (p.indexOf("Linux") == 0);
        if(system.win||system.mac||system.xll){
            return true;
        }else{
            return false;
        }
    };
    var docEl = doc.documentElement,
        resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize',
        recalc = function () {
            var clientWidth = docEl.clientWidth;
            if (!clientWidth) return;
            if(clientWidth > designWidth && isPC()) {
                clientWidth = designWidth;
            }
            rate = clientWidth / designWidth * 100;
            docEl.style.fontSize = rate + 'px';
        };
    var setMaxWidth = function () {
        if(isPC()) {
            doc.getElementById('main_box') && (doc.getElementById('main_box').style.maxWidth = designWidth + 'px');
            doc.getElementById('download_bar') && (doc.getElementById('download_bar').style.maxWidth = designWidth + 'px');
        }
    }
    if (!doc.addEventListener) return;
    win.addEventListener(resizeEvt, recalc, false);
    doc.addEventListener('DOMContentLoaded', function(){recalc(); setMaxWidth();}, false);
    recalc();
})(document, window);